﻿$(document).ready(function () {
    $(".showarticleinfo").click(function () {
        var index = $(".showarticleinfo").index(this);
        $(".articleinfotable").eq(index).toggle();
        return false;
    });
    $("#btnSort").click(function () {
        if ($("#SortHidden").val() == "") {
            alert("请选中要排序的行");
            return false;
        }
    });
    $("#cbAll").change( function () {
        $("input[name='iptckb']").attr("checked", $(this).attr("checked"));
        var valuelist = "";
        $("input[name='iptckb']").each(function (index, dom) {
            if ($(dom).is(":checked")) {
                if (valuelist == "") {
                    valuelist = $(dom).attr("value");
                }
                else {
                    valuelist = valuelist + "," + $(dom).attr("value");
                }
            }
        });
        $("#SortHidden").val(valuelist);
    });
    //构建选择行字符串
    $("input[name='iptckb']").change(function() {
        var valuelist = "";
        $("input[name='iptckb']").each(function(index, dom) {
            if ($(dom).is(":checked")) {
                if (valuelist == "") {
                    valuelist = $(dom).attr("value");
                } else {
                    valuelist = valuelist + "," + $(dom).attr("value");
                }
            }
        });
        $("#SortHidden").val(valuelist);
    });
})